<template>
  <div>
    <div class="content">
      <div class="groupProduct_title_content">
        <span class="groupProduct_title">{{content.title}}</span>
      </div>
      <div class="product_content">
        <div class="product_item" v-for="item in products">
          <div class="product_image">
            <img :src="item.thumbnail" style="width:150px;height:150px;border-radius:10px"></img>
          </div>
          <div class="right_info_content">
            <div class="product_name_content">
              <span class="name">{{item.name}}</span>
            </div>
            <div class="join_content">
              <div class="join_number_content">
                <span class="join_number">{{item.bargainNum}}人已砍价</span>
              </div>
            </div>
            <div class="price_content">
              <span class="money_icon">¥</span>
              <span class="money_number">{{item.price}}</span>
              <span class="old_momey">¥{{item.marketPrice}}</span>
            </div>
            <div class="product_bottom">
              <div class="left_content">
                <div class="left_top">
                  <span class="ping_span">邀请</span>
                  <span class="ping_number">{{item.bargainNum}}人</span>
                  <span class="ping_span">砍价,立得</span>
                  <span class="ping_number">{{item.point*0.003}}元</span>
                  <span class="ping_span">红包</span>
                </div>
                <div>
                  <span class="no_ping_span">邀请好友助力瓜分</span><span class="red_pack">{{item.point*0.007}}元</span><span class="no_ping_span">红包</span>
                </div>
              </div>
              <span class="iconfont icon">&#xe61f;</span>
            </div>
          </div>
        </div>
      </div>

    </div>
  </div>
</template>

<script>
  import  {list} from '@/api/bargainBuy'
  import  {list as pageList} from '@/api/wxPage'
  import utils from '../../../../utils/utils'
  export default {
    name: 'bargainProduct',
    data(){
      return{
        heads:[
          'http://cdnx.hulu.fj.cn/01/B5/rBD_P17--KKAHKlCAAIDjWbO9GU125.jpg',
          'http://cdnx.hulu.fj.cn/01/AD/rBD_P17zBQuAHCIkAAgtwmclk6M186.jpg',
          'http://rzico.oss-cn-shenzhen.aliyuncs.com/img/more.png'
        ],
        length:'',
        index:[],
        pageSize:2,
        products:[1]
      }
    },
    props:[
      'content'
    ],
    created() {

      this.loadProduct()
    },
    methods:{
      loadProduct(){
        let param=new URLSearchParams()
        param.append('pageSize',this.pageSize)
        list(param).then(res=>{
          res.data.data.forEach(item=>{
            if (utils.isNull(item.thumbnail)){
              item.thumbnail='http://cdnx.hulu.fj.cn/00/4B/rBD_P13d876ATFO4AAT07C99LBw961.jpg'
            }

          })
          this.products=res.data.data
        })
      }
    },
  }
</script>

<style scoped>
  .content{
    padding-left: 10px;
    padding-top: 10px;
    padding-right: 10px;
    background-color: white;
    margin-top: 10px;
    width: 375px;
    box-sizing: border-box;
  }
  .groupProduct_title{
    font-size: 18px;
    font-weight: 500;
  }
  .product_content{
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .product_item{
    display: flex;
    flex-direction: row;
    padding-bottom: 10px;
    margin-bottom: 10px;
    border-bottom: solid 1px rgba(0 ,0, 0,0.1);
  }
  .product_image{
    width: 150px;
    /*height: 1px;*/
    border-radius: 8px;
  }
  .right_info_content{
    margin-left: 10px;
    display: flex;
    flex-direction: column;
  }

  .name{
    overflow: hidden;
    span-overflow: ellipsis;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    font-size: 14px;
    font-weight: 600;
  }
  .join_content{
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
  }
  .join_number_content{
    background-color:#feece6 ;
    display: flex;
    justify-content: center;
    align-items: center;
    padding-bottom: 2.5px;
    padding-top: 2.5px;
    padding-left: 5px;
    padding-right: 5px;
  }
  .join_number{
    font-size: 11.5px;
    color: #dd7f62;
  }
  .head_content{
    /* width: 150px; */
    display: flex;
    flex-direction: row;

  }
  .head{
    width:25px;
    margin-left: -7.5px;
    height:25px;
    border-radius: 50%;
  }
  .price_content{
    margin-top: 12.5px;
    display: flex;
    flex-direction: row;
    align-items: flex-end;
  }
  .money_icon{
    color: #ca3225;
    font-size: 12.5px;
    font-weight: 600;
  }
  .money_number{
    color: #ca3225;
    font-size: 17.5px;
    margin-left: 5px;
    font-weight: 600;
    line-height: 17.5px;
  }
  .old_momey{
    font-size: 12.5px;
    margin-left: 5px;
    color: rgba(0 ,0, 0,0.3);
    text-decoration: line-through;
  }

  .product_bottom{
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
    background-color: #faeef0;
    padding-top: 5px;
    padding-bottom: 5px;
    padding-left: 10px;
    padding-right: 10px;
    border-radius: 5px;
  }
  .ping_number{
    font-size: 11px;
    color:#dd7f62 ;
  }
  .ping_span{
    font-size: 11px;
  }
  .no_ping_span{
    font-size: 11px;
  }
  .red_pack{
    color: #ca3225;
    font-size: 12.5px;
    font-weight: 600;
    margin-left: 5px;
  }
  .left_top{
    line-height: 10px;
  }

  .icon{
    font-size: 12.5px;
    color:#dd7f62 ;
  }
</style>
